/*
 * Copyright (c) 2018-2999 深圳市阿毛科技有限公司 All rights reserved.
 *
 * https://www.lamyz.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.lam.mall.api.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.lam.common.base.domain.Result;
import com.lam.framework.operLog.annotation.Log;
import com.lam.mall.app.vo.IndexImgVo;
import com.lam.mall.entity.IndexImg;
import com.lam.mall.service.IndexImgService;

import cn.hutool.core.bean.BeanUtil;

/**
 */
@Log(title = "轮播图")
@RestController
@RequestMapping("/${frontPath}")
public class IndexImgApiController {

    @Autowired
    private IndexImgService indexImgService;

    /**
     * 首页轮播图接口
     */
    @Log(oper = "首页轮播图")
    @GetMapping("/indexImgs")
    public Result indexImgs() {
        List<IndexImg> indexImgList = indexImgService.listIndexImg();
        List<IndexImgVo> indexImgVos = BeanUtil.copyToList(indexImgList, IndexImgVo.class);
        return Result.ok(indexImgVos);
    }
}
